'''
目标函数:
    max z=40*x1+90*x2
约束条件:
    9*x1+7*x2<=56
    7*x1+20*x2<=70
    x1,x2>=0 且为整数
直接使用pymprog解决,注意kind=int
'''

import pymprog

pymprog.begin('bike production')
x1, x2 = pymprog.var('x1, x2',kind=int)  # variables
pymprog.maximize(40 * x1 + 90 * x2)
pymprog.st(x1 >= 0)
pymprog.st(x2 >= 0)
pymprog.st(9 * x1 + 7 * x2 <= 56)
pymprog.st(7 * x1 + 20 * x2 <= 70)
pymprog.solve()
print("max:",pymprog.vobj())
print("x1:",x1.primal)
print("x2:",x2.primal)
pymprog.end()